package cn.nc.repository;

import cn.nc.entity.Article;
import cn.nc.entity.Comment;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface CommentRepository extends JpaRepository<Comment,Integer> {

    public List<Comment> findByArticleId(Integer id);


    @Transactional
    @Modifying
    public void deleteByArticle(Article article);

}
